<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<div id="example"></div>
		<script src="../js/react.development.js"></script>
		<script src="../js/react-dom.development.js"></script>
		<script src="../js/babel.min.js"></script>
		<script type="text/babel">
			class Like extends React.Component {
				constructor(props) {
					super(props);
					this.state = {
						isLikeMe: false,
					};
					this.handleClick = this.handleClick.bind(this);
				}

				handleClick() {
					const isLikeMe = !this.state.isLikeMe;
					this.setState({ isLikeMe });
				}
				render() {
					const { isLikeMe } = this.state;
					return (
						<h2 onClick={this.handleClick}>
							{isLikeMe ? "你喜欢我" : "我喜欢你"}
						</h2>
					);
				}
			}

			ReactDOM.render(<Like />, example);
		</script>
	</body>
</html>
